document.querySelectorAll('a[href^="#"]').forEach(elem => {
  elem.addEventListener('click', e => {
    e.preventDefault();
    document.querySelector(elem.getAttribute('href')).scrollIntoView({
      behavior: 'smooth'
    });
   
  });
});

function handleChangeTab(i){
  // console.log('i:',i);
  var lis = document.querySelector('ul').querySelectorAll('li');
  // console.log('lis:',lis);
  for(var j=0;j<lis.length;j++){
    if((i-1)==j){
      lis[j].firstChild.style.color='#fff'
    }else{
      lis[j].firstChild.style.color='#000'
    }
  }
}